#include <string.h>
#include <iostream>
using namespace std;

class Student
{
public:
    Student(int id, const char *name)
        : _id(id), _name(new char[strlen(name) + 1]())
    {
        // delete ((void *)123);
        // operator new(123);
        new int(100);
        func(12);
        strcpy(_name, name);
        cout << "Student()" << endl;
    }

    ~Student()
    {
        delete[] _name;
        cout << "~Student()" << endl;
    }

private:
    void *operator new(size_t sz)
    {
        cout << "operator new" << endl;
        cout << sz << endl;
        void *ret = malloc(sz);
        return ret;
    }

    void operator delete(void *pointer)
    {
        cout << "operator delete" << endl;
        free(pointer);
    }
    int func(int a)
    {
        return a + 1;
    }

public:
    void print() const
    {
        cout << "id:" << _id << endl
             << "name:" << _name << endl;
    }

private:
    int _id;
    char *_name;
};

// void test0()
// {
// Student * stu = new Student(100, "Jackie");
// 	stu->print();
//     delete stu;
// }
int main()
{
    Student pt1(190, "bob");
    pt1.print();

    return 0;
}